package com.ithehema;

public class StringDemo05 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3};
        String s = fun(arr);
        System.out.println(s);


    }

    public static String fun(int[] arr) {

        if (arr == null) {
            return "";
        }
        if(arr.length == 0){
            return "[]";
        }
        String result ="[";
        for (int i = 0; i < arr.length; i++) {
            if(i <arr.length-1){
                result+=arr[i]+", ";
            }else{
                result+=arr[i];
            }


        }
        result+="]";
        return result;
    }
}
